<template>
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
        <el-form-item label="院校名称" prop="name">
          <el-input
            v-model="queryParams.name"
            placeholder="请输入院校名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="专业名称" prop="proName">
          <el-input
            v-model="queryParams.proName"
            placeholder="请输入专业名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>

      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['edu:school:export']"
        >导出</el-button>
      </el-col>
        </el-row>

      <el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange"  
                     @sort-change="handleSortChange">
        <el-table-column label="序号" type="index" align="center">
          <template slot-scope="scope">
            <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column label="院校名称" align="center" prop="name" :show-overflow-tooltip="true" />
        <el-table-column label="所在城市" align="center" prop="city" :show-overflow-tooltip="true" />
        <el-table-column label="院校层次" align="center" prop="level" />
        <el-table-column label="专业名称" align="center" prop="proName" :show-overflow-tooltip="true" />
        <el-table-column label="批次" align="center" prop="type" :show-overflow-tooltip="true" />
        <el-table-column label="科目" align="center" prop="subject" />
        <el-table-column label="专业组" align="center" prop="groupName" />
        <el-table-column label="专业代码" align="center" prop="zydm" />
        <el-table-column label="C1" align="center" prop="c1" />
        <el-table-column label="C3" align="center" prop="c3" />
        <el-table-column label="C4" align="center" prop="c4" />
        <el-table-column label="C5" align="center" prop="c5" />
        <el-table-column label="2024最低分" align="center" prop="minScore2024" />
        <el-table-column label="2023最低分" align="center" prop="minScore2023" />
        <el-table-column label="2022最低分" align="center" prop="minScore2022" />
        <el-table-column label="2021最低分" align="center" prop="minScore2021" >
      </el-table-column>
 
 
    </el-table>

      <pagination v-show="total>0" 
        :total="total" 
        :page.sync="queryParams.pageNum" 
        :limit.sync="queryParams.pageSize"   
        @pagination="getList"/>
    </div>
  </template>
  
  <script>
  import { list, forceLogout,refreshCache } from "@/api/edu/school";
  
  export default {
    name: "School",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 总条数
        total: 0,
        // 表格数据
        list: [],
      // 默认排序
    
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          name: undefined,
          proName: undefined
        }
      };
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询登录日志列表 */
      getList() {
        this.loading = true;
        list(this.queryParams).then(response => {
          this.list = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      /** 刷新缓存按钮操作 */
      handleRefreshCache() {
        refreshCache().then(() => {
          this.$modal.msgSuccess("刷新成功");
        });
      } ,
      /** 多选框选中数据 */
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.multiple = !selection.length
      },
         /** 排序触发事件 */
      handleSortChange(column, prop, order) {
        this.queryParams.orderByColumn = column.prop;
        this.queryParams.isAsc = column.order;
        this.getList();
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('edu/school/export', {
          ...this.queryParams
        }, `school_${new Date().getTime()}.xlsx`)
      }
 
 
    }
  };
  </script>
  
  